#include "gndmessage.h"
#include <gtk/gtk.h>
#include <string.h>

void test_to_bin();

int main(int argc, char ** argv)
{
    test_to_bin();
    return 0;
}

void test_to_bin()
{
    gchar * data1 = "abcdefg";
    gchar * data2 = "你好你好";
    gchar * data3 = "123456789";
    GndMessage * message = gnd_message_new();
    gnd_message_add_raw_data(message, data1, strlen(data1));
    gnd_message_add_raw_data(message, data2, strlen(data2));
    gnd_message_add_raw_data(message, data3, strlen(data3));
    gchar * result_data = NULL;
    gint all_data_len = 0;
    if (!(all_data_len = gnd_message_generate_bin(message, &result_data))) {
        g_print("failure : no bin\n");
    } else {
        //result_data[all_data_len] = '\0';
        //g_print(all_data_len);
        g_print("succeed\n");
        g_print("data len : %d\n", all_data_len);
    }
}

